import { model, Schema, Types } from "mongoose";
import { Role } from '@/types/admin/role';

const RoleSchema = new Schema<Role>(
    {
        name: { type: String, required: true },
		status: { type: Boolean },
		permissions: { type: [Types.ObjectId] },
		desc: { type: String },
		key: { type: String, required: true, unique: true }
    },
    { timestamps: { createdAt: true, updatedAt: true } }
);

export const RoleModel = model("Role", RoleSchema, 'roles');